Upload files bigger than 25 MB to Github

Github has a uploading limit for 25 MB. If you use the browser mode for uploading.

One solution for this will be using Git LFS.

  1. let’s install Git lfs:
    I assume you have Homebrew installed. Open the terminal and execute.

    1
    brew install git-lfs
  2. Set up Git LFS in Git, you only have to do it once.

    1
    git lfs install
  3. Specify the file type you want to upload. If you want to upload a .mp4 file, as an example.

    1
    git lfs track "*.mp4"
  4. Add the file type to .gitattributes, so it will remember this file type, for next time uploading the same type of files you don’t have to do this step again.

    1
    git add .gitattributes
  5. Open the directory of the project in the terminal.

    1
    cd the path of the directory
  6. Creat a new repository on Github. Do not add README or gitignore.

  7. Initilize the directory as a Git reposity.

    1
    git init
  8. Add the file you want to upload from the directory.

    1
    git add test.mp4
  9. Commit the files in the local repository.

    1
    git commit -m "Upload video"
  10. Copy the URL of the remote repository, its at the top of the repository you set up at step 5.

  11. Set the repository as origin.

    1
    2
    3
    4
    5
    git remote add origin *remote repository URL*

    # Confirm the origin.

    git remote -v
  12. Push the changes in the local repository to Github.

    1
    git push -u origin master

When you have a url error, normally its the wrong url as origin.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Show the current remotes
git remote -v

# Something showing up
origin https://github.com/OWNER/REPOSITORY.git (fetch)
origin https://github.com/OWNER/REPOSITORY.git (push)

# Remove them by
git remote rm origin

# Verify remote
git remote -v

# Set the new remote by following step 11

If you have problems, feel free to comment.